home *** CD-ROM | disk | FTP | other *** search
- Path: news.kreonet.re.kr!usenet
- From: Parao@kyebek.kjist.ac.kr (Don Kim)
- Newsgroups: comp.lang.c
- Subject: [QE] : file open problem
- Date: 7 Apr 1996 15:22:18 GMT
- Organization: Kwang-ju institute of Science & Technology
- Message-ID: <4k8mja$ddn@news.kreonet.re.kr>
- NNTP-Posting-Host: kyebek5.kjist.ac.kr
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- Hello, there
-
- I have a problem with file opening.
- In my code,
-
- saveTextToFile ( char *text, char *filename) {
- FILE *file;
-
- if ( ( file = fopen (filename, "w") = = NULL )
- cout << "Cannot open file" << endl;
- else {
- (void) fprintf (file, "%s\n", text);
- (void) fclose(file);
- }
- }
-
- :
- :
-
- char *_type = "part";
- saveTextToFile ( _type, _type );
-
- Is anything wrong in my source code ? My program always displays "Cannot
- open file"....
-
- Let me know how to fix the problem.
-
-